﻿namespace DbEntityTools.Dal
{
    public class DataBaseDal
    {
        public static string GetTableFieldsDetail()
        {
            return string.Format(@"select * from (
            SELECT `information_schema`.`COLUMNS`.`TABLE_SCHEMA` as DbName
            ,`information_schema`.`COLUMNS`.`TABLE_NAME` as TableName
            ,`information_schema`.`COLUMNS`.`COLUMN_NAME` as `Field`
            ,`information_schema`.`COLUMNS`.`DATA_TYPE` as DataType
            ,`information_schema`.`COLUMNS`.COLUMN_KEY as KeyType
            ,`information_schema`.`COLUMNS`.EXTRA as Extra
            ,`information_schema`.`COLUMNS`.`COLUMN_COMMENT` as FieldDes
            ,`information_schema`.`COLUMNS`.`COLUMN_DEFAULT` as DefaultValue
            FROM `information_schema`.`COLUMNS`
            ) a ");
        }
        public static string GetTableDetail()
        {
            return string.Format(@"select * from (
                SELECT  TABLE_SCHEMA DbName,table_name TableName,TABLE_COMMENT TableDes FROM INFORMATION_SCHEMA.TABLES
                WHERE table_type='base table') a");
        }
    }
}
